import React from 'react'
import { useLocation } from 'react-router-dom' //拿到参数中的数据
import qs from 'qs' //解析查询字符串

export default function News() {
  const location = useLocation();

  const {name , age} = qs.parse(location.search.split("?")[1])
  return (
    <div>
      <h4>name:{name}</h4>
      <h4>age:{age}</h4>
    </div>
  )
}
